import os
import sys

thisDir = os.path.split(os.path.realpath(__file__))[0]
sys.path.append(os.path.join(thisDir, ".."))

import PUConst
from PU import PU

configPath = os.path.join(thisDir, "Ui.py")
schemaDir = os.path.join(thisDir, "schema")
pu = PU(configPath, schemaDir)
if pu:
    print("Create PU successful")
else:
    print("Create PU failed")
    exit
page = pu.Generate(PUConst.ClientHtml, PUConst.UiBody)
print("Generate Page:")
print(page)
with open(os.path.join(thisDir, "result.html"), "w") as f:
    f.write(page)
